package com.example.cronos;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.Chronometer;
import android.widget.Toast;

public class Cronos extends FragmentActivity {
	
	private Chronometer c;
	boolean hasStarted = false;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.cronos_activity);
    }

    public void iniciaC(View view) {
    	if ( !hasStarted ) 
    		setContentView(R.layout.cronos_activity);
    		
    		c = (Chronometer) findViewById(R.id.c);
    		
    		c.start();
    		
    		Toast.makeText(this, "Iniciado!", Toast.LENGTH_SHORT).show();
    		
    		hasStarted = true;
    	}

    public void paraC(View view) {
        if ( hasStarted ) {
        	c.stop();
        	
        	Toast.makeText(this, "Parado!", Toast.LENGTH_SHORT).show();
        	
        	hasStarted = false;
        }
    }
    
    
    
}